import React, { useState } from 'react'
import BraftEditor from 'braft-editor'
import 'braft-editor/dist/index.css'
import { Button } from 'antd'


export default function Index() {

    const [editorState, seteditorState] = useState('')
    const handleEditorChange = (e) => {
        seteditorState(e)
    }

    return (
        <div>
            <h3>富文本编辑器</h3>

            <BraftEditor
                value={editorState}
                onChange={handleEditorChange}
            />

            <Button onClick={() => {
                console.log(editorState.toHTML());
            }}> 获取输入的内容 </Button>
        </div>
    )
}
